package com.web.controller;

import com.jfinal.core.Controller;
import com.web.model.Records;
import org.apache.log4j.Logger;

import javax.servlet.http.HttpServletResponse;

/**
 * Created by reeveslee on 16/7/4.
 */
public class RecordController extends Controller {
    private static final Logger LOGGER = Logger.getLogger(RecordController.class);

    public void add() {
        int userId = (int) (long) getSession().getAttribute("userId");

        Records.recordsDao.addUserRecords(userId, getPara("record_type"), getParaToInt("record_hour"), getParaToInt("record_minute"), getParaToInt("record_second"));

        setAttr("result", true);
        HttpServletResponse response = getResponse();
        response.setHeader("Access-Control-Allow-Origin", "*");
        renderJson();
    }
}
